package parser

import (
	"encoding/json"
	"log"
	"my-crawler/concurrence/engine"
	fun "my-crawler/concurrence/task/mohurd/common"
	"my-crawler/concurrence/task/mohurd/query"
)

//最后一步解密返回值 插入数据库
func ecLicenseDetailParser(content []byte, ReqData engine.ReqData) engine.ParserResult {
	//解密字符
	res := engine.ParserResult{}

	c := fun.DecodeDecryptString(content)
	result := query.Detail1Result{}
	err := json.Unmarshal([]byte(c), &result)
	if err != nil {
		log.Fatal(err)
	}
	//update把ROW_GU插入进去
	rowGu, ok := ReqData.Payload["rowGu"]
	if !ok {
		log.Fatal("Not Found rowGu!")
	}
	result.Data.RELATIONGUID = rowGu
	res.Item = append(res.Item, result)
	return res
}
